//
//  MineCell.m
//  ChampoinPeso
//
//  Created by mac on 2025/2/18.
//

#import "MineCell.h"
#import <SDWebImage/SDWebImage.h>
@interface MineCell()
@property (nonatomic,strong)UIImageView *icon;
@property (nonatomic,strong)UILabel *name;
@end
@implementation MineCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style
                reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupUI];
    }
    return self;
}
-(void)setupUI
{
    [self.contentView addSubview:self.icon];
    [_icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.left.mas_offset(16);
        make.size.mas_equalTo(CGSizeMake(22, 22));
    }];
    [self.contentView addSubview:self.name];
    _name.text= @"Privacy Agreement";
    [_name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.left.equalTo(_icon.mas_right).offset(12);
    }];
    UIImageView *img = [UIImageView new];
    img.image = [UIImage imageNamed:@"mine_turn"];
    [self.contentView addSubview:img];
    [img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-16);
        make.centerY.mas_equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(22, 22));
    }];
}
-(UIImageView *)icon
{
    if(!_icon){
        _icon = [UIImageView new];
        _icon.image = [UIImage imageNamed:@"mine1"];
    }
    return _icon;
}

-(UILabel *)name
{
    if (!_name) {
        _name = [UILabel new];
        _name.textColor = HexColor(@"#000000");
        _name.font = [UIFont systemFontOfSize:14];
    }
    return _name;
}

-(void)setItem:(NSDictionary *)item
{
    _name.text = item[@"supposing"];
    [_icon sd_setImageWithURL:[NSURL URLWithString:item[@"thank"]]];
}
@end
